USE [texchange_db]
GO

/****** Object:  UserDefinedFunction [dbo].[Fn_GetPlace]    Script Date: 05/29/2011 19:58:20 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE FUNCTION [dbo].[Fn_GetPlace] 
(	
	-- Add the parameters for the function here
	@id  bigint=0
)
RETURNS TABLE 
AS
RETURN 
(
	-- Add the SELECT statement with parameter references here
	SELECT Places.[id], Places.[short], Places.[name], Places.[isActive], Places.[country_id], Pl.[name] as country from Places 
		LEFT JOIN Places as Pl ON Places.country_id=Pl.id
		WHERE Places.id=@id
)

GO


